import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.FindBy;

public class Selenium_testtools {

	FirefoxDriver selenium= new FirefoxDriver();
	
	public void loadHomePage(){
	
	selenium.get("http://book.theautomatedtester.co.uk");
	}
	
	public void clickAndLoadChapter2(){
		selenium.findElement(By.linkText("Chapter2")).click();
		
	}
	
	@Test
	public void shouldCheckButtonOnChapter2Page(){
		loadHomePage();
		clickAndLoadChapter2();
	
	Assert.assertEquals(selenium.findElements(By.id("but1")).size(), 1);
	selenium.close();
	}
	@SuppressWarnings("deprecation")
	@Test
	public void shouldCheckAnotherButtonOnChapter2Page(){
		loadHomePage();
		clickAndLoadChapter2();
	Assert.assertEquals(selenium.findElements(By.name("verifybutton")).size(), 1);
	selenium.close();
	}
	
	

}
